<!DOCTYPE html>
<html lang="zh-CN">
<style type="text/css">
    .title4 {
        color: #fafafa;

        letter-spacing: 0;

        font-size: 50px;

        text-shadow: 0px 1px 0px #999, 0px 2px 0px #888, 0px 3px 0px #777, 0px 4px 0px #666, 0px 5px 0px #555, 0px 6px 0px #444, 0px 7px 0px #333, 0px 8px 7px #001135;

    }

    .box {
        background-color: #FFF;
        border-radius: 5px;
        border: 1px solid #DDD;
        padding: 30px 20px;
        margin: 50px 10% 20px 10%;
        width: 80%;
        height: 500px;
        text-align: center;

    }

    .box:hover {
        box-shadow: 0 0 5px 3px #CCC;
    }

    .table11_7 table {
        width: 100%;
        margin: 15px 0;
        border: 0;
    }

    .table11_7 th {
        background-color: #00A5FF;
        color: #FFFFFF
    }

    .table11_7,
    .table11_7 th,
    .table11_7 td {
        font-size: 0.95em;
        text-align: center;
        padding: 4px;
        border-collapse: collapse;
    }

    .table11_7 th,
    .table11_7 td {
        border: 1px solid #2087fe;
        border-width: 1px 0 1px 0;
        border: 2px inset #ffffff;
    }

    .table11_7 tr {
        border: 1px solid #ffffff;
    }

    .table11_7 tr:nth-child(odd) {
        background-color: #aae1fe;
    }

    .table11_7 tr:nth-child(even) {
        background-color: #ffffff;
    }
</style>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>显示所有未审核评论</title>

    <link rel="stylesheet" href="../../Public/Css/index.css">
    <script type="text/javascript">
        function del() {
            if (confirm("确认删除评论?")) {
                return true;
            } else {
                return false;
            }
        }
    </script>
</head>

<body>


    <nav class="navbar">
        <div class="container navbar-content">
            <ul id="menu">
                <li>
                    <a href=""> 首页</a>
                </li>
                <li>
                    <a href=""> 排行</a>
                </li>
                <li>
                    <a href=""> 分类浏览</a>
                </li>
                <li>
                    <a href=""> 所有新闻</a>
                </li>
                <li>
                    <a href=""> 所有新闻</a>
                </li>
        </div><!-- /.container-fluid -->
    </nav>


    <h1 align="center" class="title4">&nbsp;&nbsp;&nbsp;新闻发布系统</h1>
    <div class="box">
        <?php
        echo "<table align=\"center\" class=table11_7 width=\"500\">";
        include_once("../../Functions/connectDatabase.php");
        include_once("../../Functions/page.php");
        get_connection();
        $sql = "SELECT * FROM review";
        $re = mysqli_query($conn, $sql);
        $total_records = mysqli_num_rows($re);
        $page_size = 5;
        if (isset($_GET["page_current"])) {
            $page_current = $_GET["page_current"];
        } else {
            $page_current = 1;
        }
        $start = ($page_current - 1) * $page_size;
        $sql = "SELECT * FROM review WHERE review_state='未审核' order by review_id desc limit $start,$page_size";
        $re = mysqli_query($conn, $sql);
        echo "<table align=\"center\" class=table11_7 width=\"500\">";
        echo "<br><br><tr><th>用户</th><th>发布时间</th><th>评论内容</th><th>操作</th></tr>";
        if (mysqli_num_rows($re) > 0) {
            while ($r1 = mysqli_fetch_assoc($re)) {
                    echo "<tr>";
                    $sql = "SELECT user_name FROM users WHERE user_id='" . $r1['user_id'] . "'";
                    $res = mysqli_query($conn, $sql);
                    $r2 = mysqli_fetch_assoc($res);
                    echo "<td>" . $r2["user_name"] . "</td>";
                    echo "<td>" . $r1["review_publish_time"] . "</td>";
                    echo "<td>" . $r1["review_content"] . "</td>";
                    echo "<td colspan=\"2\"><a href=\"./Check_V.php?id=" . $r1["review_id"] . "\">审核</a>";
                    echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
                    echo "<a href=\"./Delete_C.php?id=" . $r1["review_id"] . "\" onclick=\"return del()\">删除</a></td>";
                    echo "</tr>";
            }
        } else {
            echo "<tr><td colspan=\"4\">暂无评论</td><tr>";
        }
        page($total_records, $page_size, $page_current, $url, "");
        echo "<br><h2>所有未审核评论</h2>";
        echo "<a href=\"./Search_V.php\">搜索用户评论</a>";
        echo "<br><br>";
        close_connection();
        echo "</table>";
        ?>

    </div>

    </form>

</body>

</html>